import App from './App'
import mixin from './core/mixins/app'
import uView from './uni_modules/vk-uview-ui'
import { navTo, showToast, showSuccess, showError, getShareUrlParams, getSceneData } from './core/app'

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
  ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  // 挂载全局函数
  app.config.globalProperties.$toast = showToast
  app.config.globalProperties.$success = showSuccess
  app.config.globalProperties.$error = showError
  app.config.globalProperties.$navTo = navTo
  app.config.globalProperties.$getShareUrlParams = getShareUrlParams
  app.config.globalProperties.$getSceneData = getSceneData
  // 使用 uView UI
  app.use(uView)
  // 全局mixin
  app.mixin(mixin)
  return {
    app
  }
}
// #endif